package com.atguigu.yygh.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author A
 * @version 1.0
 * @description: TODO
 * @date 2025/3/5 23:02
 */
@EnableSwagger2
@Configuration
public class Swagger2Config {
    @Bean
    public Docket adminDocket(){
        return new Docket(DocumentationType.SWAGGER_2).groupName("admin").apiInfo(adminApiInfo()).select().paths(PathSelectors.regex("/admin/.*")).build();
    }
    @Bean
    public Docket userDocket(){
        return new Docket(DocumentationType.SWAGGER_2).groupName("user").apiInfo(userApiInfo()).select().paths(PathSelectors.regex("/user/.*")).build();
    }
    @Bean
    public Docket apiDocket(){
        return new Docket(DocumentationType.SWAGGER_2).groupName("api").apiInfo(apiApiInfo()).select().paths(PathSelectors.regex("/api/.*")).build();
    }

    private ApiInfo adminApiInfo() {
        return new ApiInfo("管理员系统API文档","管理员系统API文档各个接口的详细说明","1.0","http://www.atguigu.com","陈老师","admin@atguigu.com","http://www.atguigu.com");
    }
    private ApiInfo userApiInfo() {
        return new ApiInfo("用户系统API文档","用户系统API文档各个接口的详细说明","1.0","http://www.atguigu.com","陈老师","admin@atguigu.com","http://www.atguigu.com");
    }
    private ApiInfo apiApiInfo() {
        return new ApiInfo("医院系统API文档","医院系统API文档各个接口的详细说明","1.0","http://www.atguigu.com","陈老师","admin@atguigu.com","http://www.atguigu.com");
    }


}
